function [torque_expected,torque_inter,torque_linear]=inverse_dynamic(L,m,g,q,dq,ddq_expected,b,gra_bool)
    torque_inter = -m*g*L*cos(q)*gra_bool;
    torque_linear = m*L*L*ddq_expected + b*dq;
    torque_expected = torque_inter + torque_linear;
end